import React            from 'react';
import { BrowserRouter as Router, Switch, Redirect, Route, Link } from 'react-router-dom'

// 页面
import ProductList      from './index/index.js'
import ProductSave      from './index/save.js'
import ProductDetail    from './index/detail.js'
import CategotyList     from './categoty/index.js'
import CategotyAdd      from './categoty/add.js'

class ProductRouter extends React.Component{
  render(){
    return (
      <Switch>
        <Route path="/product/index" component={ProductList}/>
        <Route path="/product/save/:pid?" component={ProductSave}/>
        <Route path="/product/detail/:pid" component={ProductDetail}/>
        <Route path="/product-category/index/:categoryId?" component={CategotyList}/>
        <Route path="/product-category/add" component={CategotyAdd}/>
        <Redirect exact from="/product" to="/product/index"/>
        <Redirect exact from="/product-category" to="/product-category/index"/>
      </Switch>
    )
  }
}
export default ProductRouter;